#include "MessageRecvThread.h"
#include "SendGameMessage.h"
#include "MessageQueue.h"
#include "Socket.h"
#include <iostream>


MessageRecvThread::MessageRecvThread()
{

}

MessageRecvThread::MessageRecvThread(Socket* s)
{
	m_sock = *s;
}

void MessageRecvThread::Work()
{
	while (true)
	{
		GameMessage* gm;
		gm = ReceiveGameMessage(&m_sock);

		if (gm)
		{
			TheMsgQueue::Instance()->AddMessage(gm);
			std::cout << "Received a message" << std::endl;
		}
	}
}